package cn.threecubic.springcloud.controller;

import cn.threecubic.springcloud.entities.CommonResult;
import cn.threecubic.springcloud.entities.Payment;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author Terminator
 * @date 2021/12/9 11:34
 */
@RestController
public class PaymentController {


    @Value(("${server.port}"))
    private String port;

    private static HashMap<Long, Payment> hashMap = new HashMap<>();


    static {
        hashMap.put(1L, new Payment(1L, "1"));
        hashMap.put(2L, new Payment(2L, "2"));
        hashMap.put(3L, new Payment(3L, "3"));
    }


    @GetMapping("/paymentSQL/{id}")
    public CommonResult<Payment> paymentSQL(@PathVariable Long id) {
        Payment payment = hashMap.get(id);
        return new CommonResult<>(200, "成功", payment);
    }

}
